<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript">
            //<![CDATA[
            $(document).ready(function() {
                var oTable = $('#grid').dataTable({
                    "bJQueryUI": false,
                    "bAutoWidth": false,
                    "sPaginationType": "full_numbers",
                    "sDom": '<"H"fl>t<"F"ip>',
                    "aaSorting": [
                        [0, "desc"]
                    ]
                });

                $("tfoot input").keyup(function() { /* Filter on the column (the index) of this element */
                    oTable.fnFilter(this.value, $("tfoot input").index(this));
                });

                /*
                 * Support functions to provide a little bit of 'user friendlyness' to the textboxes in 
                 * the footer
                 */
                $("tfoot input").each(function(i) {
                    asInitVals[i] = this.value;
                });

                $("tfoot input").focus(function() {
                    if (this.className == "search_init") {
                        this.className = "";
                        this.value = "";
                    }
                });

                $("tfoot input").blur(function(i) {
                    if (this.value == "") {
                        this.className = "search_init";
                        this.value = asInitVals[$("tfoot input").index(this)];
                    }
                });

            });
            //]]>

        </script>
        <?php foreach ($listadoTubos as $t): ?>
            <style type="text/css">
                /*<![CDATA[*/
                #element_to_pop_up_ <?php echo $t [ 'Tubo ' ] [ 'id ' ]; ?> {
                    background-color:#fff;
                    box-shadow:0px 2px 3px rgba(0,0,0,0.298);
                    border-radius:5px;
                    color:#000;
                    display:none;
                    padding:20px;
                    min-width:300px;
                    min-height:180px;
                }

                .b-close {
                    cursor:pointer;
                    position:absolute;
                    right:10px;
                    top:5px;
                }
                /*]]>*/
            </style>
        <?php endforeach; ?>
        <title>
        </title>
    </head>
    <body>
        <div class="widget">
            <div class="whead">
                <h6>
                    LISTADO DE TRABAJOS
                </h6>
                <div class="clear">
                </div>
            </div>
            <div class="shownpars">
                <table cellpadding="0" cellspacing="0" border="0" id="grid">
                    <thead>
                        <tr>
                            <th style="width: 100px;">
                                Nombre
                            </th>
                            <th style="width: 60px;">
                                Cantidad
                            </th>
                            <th style="width: 60px;">
                                Alto
                            </th>
                            <th style="width: 60px;">
                                Largo
                            </th>
                            <th style="width: 60px;">
                                Peso
                            </th>
                            <th style="width: 60px;">
                                Estado
                            </th>
                            <th style="width: 60px;">
                                Acciones
                            </th>
                        </tr>
                    </thead>                                        

                    <tbody>
                        <?php //$i=1; ?>
                        <?php foreach ($tubosCortados as $tc): ?>
                            <tr>
                                <td>
                                    <?php echo $tc['Tubo']['nombre']; ?>
                                </td>
                                <td>
                                    <?php echo $tc['Movimientostubo']['cantidad']; ?>
                                </td>
                                <td>
                                    <?php echo $tc['Movimientostubo']['alto']; ?>
                                </td>
                                <td>
                                    <?php echo $tc['Movimientostubo']['largo']; ?>
                                </td>
                                <td>
                                    <?php echo $tc['Movimientostubo']['peso']; ?>
                                </td>
                                <td>
                                    <?php
                                    if ($tc['Movimientostubo']['estado'] == 'N')
                                    {
                                        echo 'Nuevo';
                                    } elseif ($tc['Movimientostubo']['estado'] == 'C')
                                    {
                                        echo 'Cortado';
                                    } else
                                    {
                                        echo 'Agotado';
                                    }
                                    ?>
                                </td>
                                <td>
                                    <a id="btAjaxGeneraHr_&lt;?php echo $t['Tubo']['id']; ?&gt;" name="btAjaxGeneraHr_&lt;?php echo $t['Tubo']['id']; ?&gt;"><?php echo $this->Html->image("iconos/enInventario.png", array('title' => 'Ingreso Almacen')) ?></a>
                                    <script type="text/javascript">
                                        //<![CDATA[
                                        $(document).ready(function() {
                                            // Binding a click event
                                            // From jQuery v.1.7.0 use .on() instead of .bind()
                                            $('#btAjaxGeneraHr_<?php echo $t['Tubo ']['id ']; ?>').bind('click', function(e) {
                                                // Triggering bPopup when click event is fired
                                                $('#element_to_pop_up_<?php echo $t['Tubo ']['id ']; ?>').bPopup({
                                                    fadeSpeed: 'slow',
                                                    //can be a string ('slow'/'fast') or int
                                                    followSpeed: 1500,
                                                    //can be a string ('slow'/'fast') or int 
                                                    width: 20,
                                                    //$('#element_to_pop_up_<?php //echo $t['Tubo']['id'];       ?>').bPopup()
                                                });
                                            });
                                        });
                                        //]]>

                                    </script>
                                    &nbsp;&nbsp;
                                    <a href="#"><?php echo $this->Html->image('iconos/listaInv.png', array('title' => 'Ver Cortados')) ?></a>
                                </td>
                            </tr>
<?php endforeach; ?>
                    </tbody>
                    <tfoot>
                        <tr>
                            <th rowspan="1" colspan="1">
                                <div class="formRow">
                                    <span class="grid6">
                                        <input type="text" name="search_cantidad" placeholder="Buscar Cantidad" class="search_init" />
                                    </span>
                                </div>
                            </th>
                            <th rowspan="1" colspan="1">
                                <div class="formRow">
                                    <span class="grid6">
                                        <input type="text" name="search_cantidad" placeholder="Buscar Cantidad" class="search_init" />
                                    </span>
                                </div>
                            </th>
                            <th rowspan="1" colspan="1">
                                <div class="formRow">
                                    <span class="grid6">
                                        <input type="text" name="search_alto" placeholder="Buscar Alto" class="search_init" />
                                    </span>
                                </div>
                            </th>
                            <th rowspan="1" colspan="1">
                                <div class="formRow">
                                    <span class="grid6">
                                        <input type="text" name="search_largo" placeholder="Buscar Largo" class="search_init" />
                                    </span>
                                </div>
                            </th>
                            <th rowspan="1" colspan="1">
                                <div class="formRow">
                                    <span class="grid6">
                                        <input type="text" name="search_peso" placeholder="Buscar Peso" class="search_init" />
                                    </span>
                                </div>
                            </th>
                            <th rowspan="1" colspan="1">
                                <div class="formRow">
                                    <span class="grid6">
                                        <input type="text" name="search_estado" placeholder="Buscar Estado" class="search_init" />
                                    </span>
                                </div>
                            </th>
                            <th rowspan="1" colspan="1">
                                <div class="formRow">
                                    <span class="grid6">
                                        <input type="text" name="search_cantidad" placeholder="Buscar Cantidad" class="search_init" />
                                    </span>
                                </div>
                            </th>
                        </tr>
                    </tfoot>
                </table>
            </div>
        </div>
        <?php
        echo $this->
        Html->link('INSERTAR NUEVO TRABAJO', array('action' => 'nuevahojaruta'), array('class' => 'buttonS bGreen'));
        ?>
    </body>

</html>